package org.opentcs.kcvehicle.communication.kc.udp.server;

/**
 * @Desc: ""
 * @Author: caixiang
 * @DATE: 2025/4/17 16:07
 */
public class main {
  public static void main(String[] args) {

//    //size 148 ,contentSize = 148-28 = 120
//    String errSrc = "d4 97 44 9c cb cf 0b 4c 95 51 d8 61 70 f1 e7 94 01 01 00 00 10 af 00 00 00 68 00 00 00 00 00 00 53 3a 48 bd 32 fb 7b bc ca 13 03 ba 01 00 00 00 0c 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 01 00 00 00 00 00 00 05 00 00 00 01 00 00 00 01 01 00 00 02 00 00 00 02 00 00 00 01 00 00 00 0c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00";
//    String okSrc = "d4 97 44 9c cb cf 0b 4c 95 51 d8 61 70 f1 e7 94 01 01 03 00 10 af 00 00 64 00 00 00 01 00 00 00 73 1c 30 3d 66 ba 03 3d d9 51 59 bb 00 00 00 00 0c 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0a 01 02 00 00 00 00 00 00 00 00 00 73 1c 30 3d 66 ba 03 3d d9 51 59 bb 00 00 00 00 0c 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 ";
//    String[] s = errSrc.split(" ");
//    System.out.println("size: " + s.length);
//    printInfo(s);

  }

  public static void printInfo(String[] msgs) {
    for (String b:msgs){
      System.out.print("(byte)0x"+b+",");
    }
  }

  public static void printInfos(String[] msgs){
    for (String b:msgs){
      System.out.print(""+byteToHex(Byte.valueOf(b))+" ");
    }
  }
  public static String byteToHex(byte b) {
    // 将byte转换为无符号整数
    int unsignedByte = b & 0xFF;
    // 使用Integer.toHexString方法转换为十六进制字符串
    String hexString = Integer.toHexString(unsignedByte);
    // 如果字符串长度为1，需要在前面补0
    if (hexString.length() == 1) {
      return "0" + hexString;
    }
    return hexString;
  }
}
